#include "camprec.h"

#include "DrawArrays.h"

//DWORD CDrawArrays::m_ID = 0;
CDrawArrays::CDrawArrays(void)//:IDOGL(0)
{
	//m_ID++;
	//StrID (mystr::format(_T("DrawArrays%d"),m_ID));
}

CDrawArrays::~CDrawArrays(void)
{
	Free ();
}


void CDrawArrays::Free ()
{
	while (!DrawArrayVector.empty())
	{
		delete DrawArrayVector.back();
		DrawArrayVector.pop_back();
	}
	//FreeChildObj();
}

CDrawArray* CDrawArrays::Add (const wstring &Name)
{
	CDrawArray *pDA = new CDrawArray ();
	DrawArrayVector.push_back (pDA);
	pDA->Name = Name;
	
	//RegisterChildObj (pDA->StrID(),pDA);
	
	return pDA;
}
CDrawArray* CDrawArrays::Get (const DWORD &Index)
{
	if (Index < Count ())
		return DrawArrayVector [Index];

	return NULL;
}

CDrawArray* CDrawArrays::Get (const wstring &Name)
{
	vector<CDrawArray*>::iterator it;
	for (it = DrawArrayVector.begin(); it < DrawArrayVector.end(); it++)
	{
		if ((*it)->Name.compare ( Name) == 0)
			return *it;
	}
	return NULL;
}